
//
//  ZZFinanceDataViewModel.m
//  新项目
//
//  Created by liGordon on 17/3/16.
//  Copyright © 2017年 刘耀宗. All rights reserved.
//

#import "ZZFinanceDataViewModel.h"

@implementation ZZFinanceDataViewModel


+(instancetype)shareViewModel{
    static id instance;
    static  dispatch_once_t once;
    dispatch_once(&once, ^{
        instance=[[self alloc] init];
    });
    return instance;
    
}

-(void)getFinanceAnalysisWithStime:(NSString *)Stime andETime:(NSString *)Etime andPlateNumber:(NSString *)plateNumber andCarOwner:(NSString *)carOwner andWXXM:(NSString *)WXXM andZXR:(NSString *)ZXR andGZ:(NSString *)GZ andPartsName:(NSString *)partsName andRepairsNo:(NSString *)repairsNo andMakeName:(NSString *)makeName andCreatorName:(NSString *)creatorName anditype:(NSString *)itype andCompanyID :(NSString *)companyID andPageIndex:(NSString *)pageIndex andPageSize:(NSString *)pageSize andType:(NSString *)type andSuccess:(void (^)(NSDictionary *))success andFailer:(void (^)())failer
{

    NSMutableDictionary *strDic = [NSMutableDictionary dictionary];
    [strDic setKey:@"STime" forValue:Stime];
    [strDic setKey:@"ETime" forValue:Etime];
    [strDic setKey:@"PlateNumber" forValue:plateNumber];
    [strDic setKey:@"CarOwner" forValue:carOwner];
    [strDic setKey:@"WXXM" forValue:WXXM];
    [strDic setKey:@"ZXR" forValue:ZXR];
    [strDic setKey:@"GZ" forValue:GZ];
    [strDic setKey:@"PartsName" forValue:partsName];
    [strDic setKey:@"RepairsNo" forValue:repairsNo];
    [strDic setKey:@"MakeName" forValue:makeName];
    [strDic setKey:@"CreatorName" forValue:creatorName];
    [strDic setKey:@"itype" forValue:itype];
    [strDic setKey:@"CompanyID" forValue:companyID];
    [strDic setKey:@"pageIndex" forValue:pageIndex];
    [strDic setKey:@"pageSize" forValue:pageSize];
    [strDic setKey:@"type" forValue:type];
    
    NSString *jsonStr=[WHJSON jsonStringWithObject:strDic];
    
    NSMutableDictionary *dic=[NSMutableDictionary dictionary];
    [dic setKey:@"data" forValue:jsonStr];
    
    
    [YBHttpTool post:@"api/CmpReporting/Data/GetRank" params:dic success:^(NSDictionary *obj) {
        
        
        DLog(@"=====%@",obj);
        if ([obj isKindOfClass:[NSNull class]] || obj==nil) {
            DLog(@"返回值为空");
            return ;
        }
        success(obj);
        
    } failure:^(NSError *error) {
        DLog(@"%@",error);
        failer();
    }];
}

@end
